<?php

namespace Budget\BudgetBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class MainController extends Controller
{
    /**
     * Return the logged user
     *
     * @return \Budget\BudgetBundle\Entity\User
     */
    public function getUser()
    {
        return $this->get('security.context')->getToken()->getUser();
    }

    /**
     * Returns Entity Manager
     *
     * @return \Doctrine\ORM\EntityManager
     */
    public function getEntityManager()
    {
        return $this->getDoctrine()->getManager();
    }

    /**
     * Set positive message
     *
     * @param $message
     */
    public function setPositveMsg($message) 
    {
        $this->get('session')->getFlashBag()->set('success', $message);
    }
}